package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.JiajiaMallRecevingAddress;
import com.ruoyi.system.mapper.JiajiaMallRecevingAddressMapper;
import com.ruoyi.system.service.IJiajiaMallRecevingAddressService;
import com.ruoyi.system.utils.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商城地址簿Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-05
 */
@Service
public class JiajiaMallRecevingAddressServiceImpl implements IJiajiaMallRecevingAddressService 
{
    @Autowired
    private JiajiaMallRecevingAddressMapper jiajiaMallRecevingAddressMapper;

    /**
     * 查询商城地址簿
     * 
     * @param id 商城地址簿主键
     * @return 商城地址簿
     */
    @Override
    public JiajiaMallRecevingAddress selectJiajiaMallRecevingAddressById(Long id)
    {
        return jiajiaMallRecevingAddressMapper.selectJiajiaMallRecevingAddressById(id);
    }

    /**
     * 查询商城地址簿列表
     * 
     * @param jiajiaMallRecevingAddress 商城地址簿
     * @return 商城地址簿
     */
    @Override
    public List<JiajiaMallRecevingAddress> selectJiajiaMallRecevingAddressList(JiajiaMallRecevingAddress jiajiaMallRecevingAddress)
    {
        return jiajiaMallRecevingAddressMapper.selectJiajiaMallRecevingAddressList(jiajiaMallRecevingAddress);
    }

    /**
     * 新增商城地址簿
     * 
     * @param jiajiaMallRecevingAddress 商城地址簿
     * @return 结果
     */
    @Override
    public int insertJiajiaMallRecevingAddress(JiajiaMallRecevingAddress jiajiaMallRecevingAddress)
    {
        jiajiaMallRecevingAddress.setCreateTime(DateUtils.getNowDate());
        jiajiaMallRecevingAddress.setUid(TokenUtil.getUid());
        return jiajiaMallRecevingAddressMapper.insertJiajiaMallRecevingAddress(jiajiaMallRecevingAddress);
    }

    /**
     * 修改商城地址簿
     * 
     * @param jiajiaMallRecevingAddress 商城地址簿
     * @return 结果
     */
    @Override
    public int updateJiajiaMallRecevingAddress(JiajiaMallRecevingAddress jiajiaMallRecevingAddress)
    {
        jiajiaMallRecevingAddress.setUpdateTime(DateUtils.getNowDate());
        return jiajiaMallRecevingAddressMapper.updateJiajiaMallRecevingAddress(jiajiaMallRecevingAddress);
    }

    /**
     * 批量删除商城地址簿
     * 
     * @param ids 需要删除的商城地址簿主键
     * @return 结果
     */
    @Override
    public int deleteJiajiaMallRecevingAddressByIds(String ids)
    {
        return jiajiaMallRecevingAddressMapper.deleteJiajiaMallRecevingAddressByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除商城地址簿信息
     * 
     * @param id 商城地址簿主键
     * @return 结果
     */
    @Override
    public int deleteJiajiaMallRecevingAddressById(Long id)
    {
        return jiajiaMallRecevingAddressMapper.deleteJiajiaMallRecevingAddressById(id);
    }
}
